<%--
  Created by IntelliJ IDEA.
  User: 赵千陆
  Date: 2020/10/9
  Time: 8:23
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>tag lib demo</title>
</head>
<body>
<h2>Taglib demo</h2>
<%--c:set tag--%>
<div>
    <h3>&lt;c:set&gt;example</h3>
    <c:set var="mag" value="This is a message"/>
    <c:out value="${msg}"/>
</div>
<%--c:forEach输出1-100的偶数--%>
<div>
    <h3>&lt;c:forEach&gt; example</h3>
    <c:forEach var="i" begin="1" end="100">
        <c:if test="${i % 2 == 0}">
            <c:out value="${i}"/>
        </c:if>
    </c:forEach>
</div>
<%--c:choose的例子--%>
<div>
    <h3>&lt;c:choose&gt; example</h3>
    <c:set var="score" value="${45*2}"/>
    <c:out value="your score is ${score}"/>
    <c:choose>
        <c:when test="${score<60}">
            <c:out value="不及格"/>
        </c:when>
        <c:when test="${score>=60&&score<90}">
            <c:out value="成绩良"/>
        </c:when>
        <c:otherwise>
            <c:out value="你的成绩为优"/>
        </c:otherwise>
    </c:choose>
</div>
</body>
</html>
